import { request } from 'umi';

// --- Cleaner --- //

// 创建保洁人员
export async function createCleaner(params) {
  return request('/api/v1/cleaner', {
    method: 'POST',
    data: params,
  });
}

// 获取所有保洁人员
export async function getAllCleaners(params) {
  return request('/api/v1/cleaner', {
    method: 'GET',
    params,
  });
}

// 获取单个保洁人员
export async function getCleanerById(id) {
  return request(`/api/v1/cleaner/${id}`, {
    method: 'GET',
  });
}

// 更新保洁人员
export async function updateCleaner(id, params) {
  return request(`/api/v1/cleaner/${id}`, {
    method: 'PUT',
    data: params,
  });
}

// 删除保洁人员
export async function deleteCleaner(id) {
  return request(`/api/v1/cleaner/${id}`, {
    method: 'DELETE',
  });
}

// --- Cleaning Setting --- //

// 获取保洁设置列表
export async function getCleaningSettings(params) {
  return request('/api/v1/cleaning/setting', {
    method: 'GET',
    params,
  });
}

// 根据门店ID获取保洁设置
export async function getCleaningSettingByStoreId(storeId) {
  return request('/api/v1/cleaning/setting', {
    method: 'GET',
    params: { store_id: storeId },
  });
}

// 创建保洁设置
export async function createCleaningSetting(data) {
  return request('/api/v1/cleaning/setting', {
    method: 'POST',
    data,
  });
}

// 更新保洁设置
export async function updateCleaningSetting(id, data) {
  return request(`/api/v1/cleaning/setting/${id}`, {
    method: 'PUT',
    data,
  });
}

// 删除保洁设置
export async function deleteCleaningSetting(id) {
  return request(`/api/v1/cleaning/setting/${id}`, {
    method: 'DELETE',
  });
}

// --- Cleaning Record --- //

// 创建保洁记录
export async function createCleaningRecord(params) {
  return request('/api/v1/cleaning/record', {
    method: 'POST',
    data: params,
  });
}

// 获取所有保洁记录
export async function getAllCleaningRecords(params) {
  return request('/api/v1/cleaning/record', {
    method: 'GET',
    params,
  });
}

// 获取单个保洁记录
export async function getCleaningRecordById(id) {
  return request(`/api/v1/cleaning/record/${id}`, {
    method: 'GET',
  });
}

// 更新保洁记录
export async function updateCleaningRecord(id, params) {
  return request(`/api/v1/cleaning/record/${id}`, {
    method: 'PUT',
    data: params,
  });
}
export async function deleteCleaningRecord(id, params) {
  return request(`/api/v1/cleaning/record/${id}`, {
    method: 'DELETE',
    data: params,
  });
}
